package main

import (
	"fmt"
	"log"
	"os"

	"github.com/unidoc/unioffice/document"
)

func convertWordToHTML(inputPath, outputPath string) error {
	doc, err := document.Open(inputPath)
	if err != nil {
		return err
	}

	html, err := doc.HTML()
	if err != nil {
		return err
	}

	outputFile, err := os.Create(outputPath)
	if err != nil {
		return err
	}
	defer outputFile.Close()

	_, err = outputFile.WriteString(html)
	return err
}

func main() {
	inputPath := "path/to/your/input.docx"
	outputPath := "path/to/your/output.html"

	err := convertWordToHTML(inputPath, outputPath)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Conversion complete.")
}
